local hongzai = fk.CreateSkill {
  name = "lingling__hongzai",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable {
  ["lingling__hongzai"] = "洪灾",
  [":lingling__hongzai"] = "锁定技，每名角色回合结束时，其判定，若为黑色则其随机弃置一张牌，若为黑桃，其受到1点无来源伤害。",
}

hongzai:addEffect(fk.TurnEnd, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(hongzai.name)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local judge = {
      who = target,
      reason = hongzai.name,
      pattern = ".|.|spade,club",
    }
    room:judge(judge)
    if not target.dead and not target:isNude() and judge.card and judge.card.color == Card.Black then
      room:throwCard(table.random(target:getCardIds("he")), hongzai.name, target, target)
    end
    if not target.dead and judge.card and judge.card.suit == Card.Spade then
      room:damage({
        to = target,
        damage = 1,
        reason = hongzai.name,
      })
    end
  end,
})

return hongzai
